home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Misc Servers / Zope.exe / DTML-IF.STX < prev    next >
Encoding:
Text File  |  2000-10-12  |  1.6 KB  |  58 lines

  1. if: Tests Conditions
  2.  
  3.   The 'if' tags allows you to test conditions and to take different
  4.   actions depending on the conditions. The 'if' tag mirrors Python's
  5.   'if/elif/else' condition testing statements.
  6.  
  7.   Syntax
  8.  
  9.     If tag syntax::
  10.  
  11.       <dtml-if ConditionVariable|expr="ConditionExpression">
  12.     [<dtml-elif ConditionVariable|expr="ConditionExpression">]
  13.      ...
  14.     [<dtml-else>]
  15.       </dtml-if>
  16.  
  17.     The 'if' tag is a block tag. The 'if' tag and optional 'elif' tags
  18.     take a condition variable name or a condition expression, but not
  19.     both. If the condition name or expression evaluates to true then
  20.     the 'if' block is executed. True means not zero, an empty string
  21.     or an empty list.  If the condition variable is not found then the
  22.     condition is considered false.
  23.  
  24.     If the initial condition is false, each 'elif' condition is tested
  25.     in turn. If any 'elif' condition is true, its block is
  26.     executed. Finally the optional 'else' condition is tested. If it
  27.     is true, the 'else' block is executed. Only one block will be
  28.     executed.
  29.  
  30.   Examples
  31.  
  32.     Testing for a variable::
  33.  
  34.       <dtml-if snake>
  35.         The snake variable is true
  36.       </dtml-if>
  37.  
  38.     Testing for expression conditions::
  39.  
  40.       <dtml-if expr="num > 5">
  41.         num is greater than five
  42.       <dtml-elif expr="num < 5">
  43.         num is less than five
  44.       <dtml-else>
  45.         num must be five
  46.       </dtml-if>
  47.  
  48.   See Also
  49.  
  50.     "Python Tutorial: If Statements":http://www.python.org/doc/current/tut/node6.html#SECTION006100000000000000000
  51.   
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.